package ar.com.fiuba.ElectronicCircuitAnalyst.domain.api;

import java.util.List;

/**
 * An element that could be used as a component in a circuit
 * 
 */
public interface CircuitElement {

	/**
	 * Getter for the name of the circuit element.
	 * 
	 * @return the name.
	 */
	public String getName();

	/**
	 * Creates a connection between an input of this CircuitElement and the
	 * given lead.
	 * 
	 * @param index
	 *            the index of an input (of this CircuitElement)
	 * @param from
	 *            the lead to connect
	 * @return the connection between the leads
	 */
	public Connection connectToInputLead(int index, Lead from);

	/**
	 * Creates a connection between an output of this CircuitElement and the
	 * given lead.
	 * 
	 * @param index
	 *            the index of an output (of this CircuitElement)
	 * @param to
	 *            the lead to connect.
	 * @return the connection between the leads
	 */
	public Connection connectFromOutputLead(int index, Lead to);

	/**
	 * Simulates one "tick" of the clock for this CircuitElement.
	 */
	public void simulate();

	/**
	 * @return a list with the input leads of the CircuitElement
	 */
	public List<Lead> getInputLeads();

	/**
	 * @return a list with the output leads of the CircuitElement
	 */
	public List<Lead> getOutputLeads();
}
